<link rel="stylesheet" type="text/css" href="../Another/Style/menudong.css">
<script type="text/javascript" src="../Another/JQuery/jquery1.9.2.min.js"></script>
<script type="text/javascript" src="../Another/JQuery/menu_tab.js"></script>
<?php
    require_once "configg.php";
    function  buiding_menu($parent,$menuData){
        $html="";
        if(isset($menuData['parent'][$parent])){
            $html.="<ul class='nav'>";
            foreach($menuData['parent'][$parent] as $value){
                $html.="<li>";
                $html.="<a href='".$menuData['items'][$value]['link_lienket']."'>".$menuData['items'][$value]['name']."</a>";
                $html.=buiding_menu($value,$menuData);
                $html.="</li>";
            }
            $html.="</ul>";
        }
        return $html;
    }
    $result=$db->select($connection,"SELECT * FROM menu");
    foreach($result as $value){
        $menuData['items'][$value['id']]=$value;//Lưu dữ liệu các biến có id khác nh
        $menuData['parent'][$value['parent']][]=$value['id'];
    }
?>

<?php
    echo buiding_menu(0,$menuData);
?>
